
d = {1:1}


def solve(i):
    l = d.get(i)
    if l is not None:
        return l
    else:
        if i & 1:
            l = 1 + solve(i * 3 + 1)
        else:
            l = 1 + solve(i >> 1)
        d[i] = l
        return l

results = []
for i in range(1,1000000):
    results.append((solve(i), i))

print max(results)